import request from '@/router/axios'

/**
 * 一键生成
 * @param data
 */
export const generate = (examineId) => {
    return request({
        url: '/exam/kpi/examine/generate',
        method: 'post',
        params: {
            examineId,
        }
    })
}

/**
 * 统计评分
 * @param data
 */
export const finishScore = () => {
    return request({
        url: '/exam/kpi/finishScore',
        method: 'get',
    })
}

/**
* 存入草稿
* @param data
*/
export const submit = (data) => {
    return request({
        url: '/exam/kpi/examine/submit',
        method: 'post',
        data: data
    })
}
/**
 * 删除
 * @param ids
 * @returns {*}
 */
export const remove = (ids) => {
    return request({
        url: '/exam/kpi/examine/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}

/**
 * 删除考核评分
 * @param ids
 * @returns {*}
 */
export const removeScore = (ids) => {
    return request({
        url: '/exam/kpi/examine/removeExamineScore',
        method: 'post',
        params: {
            ids,
        }
    })
}

/**
 * 详情
 * @param id
 */
export const getDetail = (id) => {
    return request({
        url: '/exam/kpi/examine/detail',
        method: 'get',
        params: {
            id
        }
    })
}

export const getList = (current, size, params) => {
    return request({
        url: '/exam/kpi/examine/list',
        method: 'get',
        params: {
            ...params,
            current,
            size,
        }
    })
}

/**
 * 获取个人最终得分
 * @returns {AxiosPromise}
 */
export const getScore = () => {
    return request({
        url: '/exam/kpi/statScore',
        method: 'get'
    })
}

export const getScorePerson = (status) => {
    return request({
        url: '/exam/kpi/statScorePerson',
        method: 'get',
        params: {
            status
        }
    })
}
